import { Map } from 'immutable'
import * as actionTypes from './constants'

const defaultState = Map({
  topLists: [],
  currentIndex: 0,
  playLists: {}, 
})

export default (state = defaultState, action) => {
  switch(action.type) {
    case actionTypes.CHANGE_TOP_LISTS: 
      return state.set("topLists", action.topLists)
    case actionTypes.CHANGE_CURRENT_INDEX:
      return state.set("currentIndex", action.currentIndex)
    case actionTypes.CHANGE_PLAY_LISTS:
      return state.set("playLists", action.playLists)
    default:
      return state
  }
}